<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="x-UA-Compatible" content="ie=Edge">
   	<meta name="viewport" content="width=device-width, initial-scale=1">
   	<title>Crafty - Crafty Core</title>
	<link type="text/css" rel="stylesheet" href="../craftyjs-site.css" />
	<link rel="shortcut icon" href="../favicon.ico">
	
</head>
<body>
	<div id = "header-background"> </div>
	<div id = "page-frame">
	<div id="header">
		<nav class="navbar">
  			<div class="container-fluid">
  				<div class="navbar-header">
  					<a class="navbar-brand" href="../"> <img class="logo" src="../images/text-logo.png" /> </a>
  					
				</div>
				<div class="collapse navbar-collapse navbar-right" id="bs-example-navbar-collapse-1">
					<ul class="nav navbar-nav">
						<li><a href="../">首页</a></li>
						<li><a href="../getting-started/">快速开始</a></li>
						<li><a href="../documentation/">文档</a></li>
						<li><a href="../api/">API</a></li>
						<li><a href="../components/">组件</a></li>
						<li class="emph"><a href="../#install">下载</a></li>
					</ul>
				</div>
			</div>
		</nav>
	</div>


	<div id="main">
		<div id="content" class="container">
			



<div id="docs"><div class="toc-holder" id="doc-nav"><ul id="doc-level-one"><li><a href="events.html">List of Events</a></li><li class="category">Core<ul class="category-list"><li><a href="Crafty.html">Crafty</a></li><li><a href="Crafty Core.html">Crafty Core</a></li><li><a href="Crafty-bind.html">Crafty.bind()</a></li><li><a href="Crafty-c.html">Crafty.c()</a></li><li><a href="Crafty-clone.html">Crafty.clone()</a></li><li><a href="Crafty-defineField.html">Crafty.defineField()</a></li><li><a href="Crafty-e.html">Crafty.e()</a></li><li><a href="Crafty-extend.html">Crafty.extend()</a></li><li><a href="Crafty-frame.html">Crafty.frame()</a></li><li><a href="Crafty-getVersion.html">Crafty.getVersion()</a></li><li><a href="Crafty-init.html">Crafty.init()</a></li><li><a href="Crafty-isPaused.html">Crafty.isPaused()</a></li><li><a href="Crafty-one.html">Crafty.one()</a></li><li><a href="Crafty-pause.html">Crafty.pause()</a></li><li><a href="Crafty-s.html">Crafty.s()</a></li><li><a href="Crafty-settings.html">Crafty.settings</a></li><li><a href="Crafty-stage.html">Crafty.stage</a></li><li><a href="Crafty-stop.html">Crafty.stop()</a></li><li><a href="Crafty-support.html">Crafty.support</a></li><li><a href="Crafty-trigger.html">Crafty.trigger()</a></li><li><a href="Crafty-unbind.html">Crafty.unbind()</a></li><li><a href="Crafty-uniqueBind.html">Crafty.uniqueBind()</a></li></ul></li><li class="category">2D<ul class="category-list"><li><a href="2D.html">2D</a></li><li><a href="AngularMotion.html">AngularMotion</a></li><li><a href="Collision.html">Collision</a></li><li><a href="Crafty-circle.html">Crafty.circle</a></li><li><a href="Crafty-diamondIso.html">Crafty.diamondIso</a></li><li><a href="Crafty-HashMap.html">Crafty.HashMap</a></li><li><a href="Crafty-isometric.html">Crafty.isometric</a></li><li><a href="Crafty-map.html">Crafty.map</a></li><li><a href="Crafty-math-Matrix2D.html">Crafty.math.Matrix2D</a></li><li><a href="Crafty-math-Vector2D.html">Crafty.math.Vector2D</a></li><li><a href="Crafty-polygon.html">Crafty.polygon</a></li><li><a href="Crafty-raycast.html">Crafty.raycast()</a></li><li><a href="Crafty-rectManager.html">Crafty.rectManager</a></li><li><a href="Gravity.html">Gravity</a></li><li><a href="GroundAttacher.html">GroundAttacher</a></li><li><a href="Motion.html">Motion</a></li><li><a href="Supportable.html">Supportable</a></li></ul></li><li class="category">Animation<ul class="category-list"><li><a href="Crafty-easing.html">Crafty.easing</a></li><li><a href="SpriteAnimation.html">SpriteAnimation</a></li><li><a href="Tween.html">Tween</a></li></ul></li><li class="category">Assets<ul class="category-list"><li><a href="Crafty-asset.html">Crafty.asset()</a></li><li><a href="Crafty-assets.html">Crafty.assets</a></li><li><a href="Crafty-imageWhitelist.html">Crafty.imageWhitelist()</a></li><li><a href="Crafty-load.html">Crafty.load()</a></li><li><a href="Crafty-paths.html">Crafty.paths()</a></li><li><a href="Crafty-removeAssets.html">Crafty.removeAssets()</a></li></ul></li><li class="category">Audio<ul class="category-list"><li><a href="Crafty-audio.html">Crafty.audio</a></li></ul></li><li class="category">Controls<ul class="category-list"><li><a href="Controllable.html">Controllable</a></li><li><a href="Controls.html">Controls</a></li><li><a href="Draggable.html">Draggable</a></li><li><a href="Fourway.html">Fourway</a></li><li><a href="Jumper.html">Jumper</a></li><li><a href="Multiway.html">Multiway</a></li><li><a href="Twoway.html">Twoway</a></li></ul></li><li class="category">Debug<ul class="category-list"><li><a href="Crafty-error.html">Crafty.error()</a></li><li><a href="Crafty-log.html">Crafty.log()</a></li><li><a href="DebugCanvas.html">DebugCanvas</a></li><li><a href="DebugPolygon.html">DebugPolygon</a></li><li><a href="DebugRectangle.html">DebugRectangle</a></li><li><a href="SolidAreaMap.html">SolidAreaMap</a></li><li><a href="SolidHitBox.html">SolidHitBox</a></li><li><a href="VisibleMBR.html">VisibleMBR</a></li><li><a href="WiredAreaMap.html">WiredAreaMap</a></li><li><a href="WiredHitBox.html">WiredHitBox</a></li></ul></li><li class="category">Events<ul class="category-list"><li><a href="Crafty-addEvent.html">Crafty.addEvent()</a></li><li><a href="Crafty-bind.html">Crafty.bind()</a></li><li><a href="Crafty-one.html">Crafty.one()</a></li><li><a href="Crafty-removeEvent.html">Crafty.removeEvent()</a></li><li><a href="Crafty-trigger.html">Crafty.trigger()</a></li><li><a href="Crafty-unbind.html">Crafty.unbind()</a></li><li><a href="Crafty-uniqueBind.html">Crafty.uniqueBind()</a></li></ul></li><li class="category">Game Loop<ul class="category-list"><li><a href="Crafty-timer.html">Crafty.timer</a></li></ul></li><li class="category">Graphics<ul class="category-list"><li><a href="Canvas.html">Canvas</a></li><li><a href="CanvasLayer.html">CanvasLayer</a></li><li><a href="Color.html">Color</a></li><li><a href="Crafty-assignColor.html">Crafty.assignColor()</a></li><li><a href="Crafty-background.html">Crafty.background()</a></li><li><a href="Crafty-createLayer.html">Crafty.createLayer()</a></li><li><a href="Crafty-defaultShader.html">Crafty.defaultShader()</a></li><li><a href="Crafty-domHelper.html">Crafty.domHelper</a></li><li><a href="Crafty-pixelart.html">Crafty.pixelart()</a></li><li><a href="Crafty-sprite.html">Crafty.sprite()</a></li><li><a href="Crafty-WebGLShader.html">Crafty.WebGLShader()</a></li><li><a href="DOM.html">DOM</a></li><li><a href="DomLayer.html">DomLayer</a></li><li><a href="HTML.html">HTML</a></li><li><a href="Image.html">Image</a></li><li><a href="Particles.html">Particles</a></li><li><a href="Renderable.html">Renderable</a></li><li><a href="Sprite.html">Sprite</a></li><li><a href="Text.html">Text</a></li><li><a href="WebGL.html">WebGL</a></li><li><a href="WebGLLayer.html">WebGLLayer</a></li></ul></li><li class="category">Input<ul class="category-list"><li><a href="AreaMap.html">AreaMap</a></li><li><a href="Button.html">Button</a></li><li><a href="Crafty-findPointerEventTargetByComponent.html">Crafty.findPointerEventTargetByComponent()</a></li><li><a href="Crafty-keyboardDispatch.html">Crafty.keyboardDispatch()</a></li><li><a href="Crafty-keydown.html">Crafty.keydown</a></li><li><a href="Crafty-keys.html">Crafty.keys</a></li><li><a href="Crafty-lastEvent.html">Crafty.lastEvent</a></li><li><a href="Crafty-mouseButtons.html">Crafty.mouseButtons</a></li><li><a href="Crafty-mouseDispatch.html">Crafty.mouseDispatch()</a></li><li><a href="Crafty-mouseWheelDispatch.html">Crafty.mouseWheelDispatch()</a></li><li><a href="Crafty-multitouch.html">Crafty.multitouch()</a></li><li><a href="Crafty-selected.html">Crafty.selected</a></li><li><a href="Crafty-touchDispatch.html">Crafty.touchDispatch()</a></li><li><a href="Keyboard.html">Keyboard</a></li><li><a href="Mouse.html">Mouse</a></li><li><a href="MouseDrag.html">MouseDrag</a></li><li><a href="Touch.html">Touch</a></li></ul></li><li class="category">Misc<ul class="category-list"><li><a href="Crafty-addEvent.html">Crafty.addEvent()</a></li><li><a href="Crafty-device.html">Crafty.device</a></li><li><a href="Crafty-removeEvent.html">Crafty.removeEvent()</a></li><li><a href="Crafty-support.html">Crafty.support</a></li></ul></li><li class="category">Model<ul class="category-list"><li><a href="Model.html">Model</a></li></ul></li><li class="category">Scenes<ul class="category-list"><li><a href="Crafty-scene.html">Crafty.scene()</a></li></ul></li><li class="category">Stage<ul class="category-list"><li><a href="Crafty-background.html">Crafty.background()</a></li><li><a href="Crafty-scene.html">Crafty.scene()</a></li><li><a href="Crafty-viewport.html">Crafty.viewport</a></li></ul></li><li class="category">Utilities<ul class="category-list"><li><a href="Crafty-math.html">Crafty.math</a></li><li><a href="Delay.html">Delay</a></li><li><a href="Storage.html">Storage</a></li></ul></li></ul></div><div id="doc-content" class="doc-page-holder"><div class="doc-page"><h1>Crafty Core <span></span></h1><div class="doclet" id="Crafty Core"><div class="triggered-events"><h4>Events</h4><div class="trigger-list"><dl class="trigger"><dt>NewEntityName <span>[<span class="trigger-data"><span class="obj-name">entity name</span><span class="obj-props"> = {String}</span></span>]</span></dt><dd>After setting new name for entity</dd></dl><dl class="trigger"><dt>NewComponent <span>[<span class="trigger-data"><span class="obj-name">Component</span><span class="obj-props"> = {String}</span></span>]</span></dt><dd>when a new component is added to the entity</dd></dl><dl class="trigger"><dt>RemoveComponent <span>[<span class="trigger-data"><span class="obj-name">Component</span><span class="obj-props"> = {String}</span></span>]</span></dt><dd>when a component is removed from the entity</dd></dl><dl class="trigger"><dt>Remove </dt><dd>when the entity is removed by calling .destroy()</dd></dl></div></div><span class="markdown"><p>A set of methods added to every single entity.</p>
</span></div><div><h4>Methods</h4><ul class="page-toc"><li><a href="#-addComponent">.addComponent()</a></li><li><a href="#-attr">.attr()</a></li><li><a href="#-bind">.bind()</a></li><li><a href="#-clone">.clone()</a></li><li><a href="#-defineField">.defineField()</a></li><li><a href="#-destroy">.destroy()</a></li><li><a href="#-each">.each()</a></li><li><a href="#-get">.get()</a></li><li><a href="#-getId">.getId()</a></li><li><a href="#-getName">.getName()</a></li><li><a href="#-has">.has()</a></li><li><a href="#-one">.one()</a></li><li><a href="#-removeComponent">.removeComponent()</a></li><li><a href="#-requires">.requires()</a></li><li><a href="#-setName">.setName()</a></li><li><a href="#-setter">.setter()</a></li><li><a href="#-timeout">.timeout()</a></li><li><a href="#-toArray">.toArray()</a></li><li><a href="#-toggleComponent">.toggleComponent()</a></li><li><a href="#-trigger">.trigger()</a></li><li><a href="#-unbind">.unbind()</a></li><li><a href="#-uniqueBind">.uniqueBind()</a></li></ul><div class="doclet" id="-addComponent"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.addComponent()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.addComponent</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">componentList</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> componentList </dt><dd><span class="markdown"><p>A string of components to add separated by a comma <code>,</code></p>
</span></dd></dl></div><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.addComponent</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">Component1</span></span><span class="sig-seperator">[,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-noun">..</span></span><span class="sig-seperator">,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">String </span><span class="sig-noun">ComponentN</span></span><span class="sig-seperator">])</span></code><dl class="parameter"><dt> Component# </dt><dd><span class="markdown"><p>Component ID to add.</p>
</span></dd></dl></div><span class="markdown"><p>Adds a component to the selected entities or entity.</p>
<p>Components are used to extend the functionality of entities.
This means it will copy properties and assign methods to
augment the functionality of the entity.</p>
<p>For adding multiple components, you can either pass a string with
all the component names (separated by commas), or pass each component name as
an argument.</p>
<p>If the component has a function named <code>init</code> it will be called.</p>
<p>If the entity already has the component, the component is skipped (nothing happens).</p>
</span><div class="example"><h4>Example</h4><span class="markdown"><pre><code class="hljs "><span class="hljs-keyword">this</span>.addComponent(<span class="hljs-string">"2D, Canvas"</span>);
<span class="hljs-keyword">this</span>.addComponent(<span class="hljs-string">"2D"</span>, <span class="hljs-string">"Canvas"</span>);</code></pre></span></div></div><div class="doclet" id="-attr"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.attr()</h2><div class="triggered-events"><h4>Events</h4><div class="trigger-list"><dl class="trigger"><dt>Change <span>[<span class="trigger-data"><span class="obj-name">Data</span><span class="obj-props"> = {key: value}</span></span>]</span></dt><dd>when properties change</dd></dl></div></div><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.attr</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">property</span></span><span class="sig-seperator">,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Any </span><span class="sig-noun">value</span></span><span class="sig-seperator">[,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Boolean </span><span class="sig-noun">silent</span></span><span class="sig-seperator">[,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Boolean </span><span class="sig-noun">recursive</span></span><span class="sig-seperator">]])</span></code><dl class="parameter"><dt> property </dt><dd><span class="markdown"><p>Property of the entity to modify</p>
</span></dd></dl><dl class="parameter"><dt> value </dt><dd><span class="markdown"><p>Value to set the property to</p>
</span></dd></dl><dl class="parameter"><dt> silent </dt><dd><span class="markdown"><p>If you would like to supress events</p>
</span></dd></dl><dl class="parameter"><dt> recursive </dt><dd><span class="markdown"><p>If you would like merge recursively</p>
</span></dd></dl></div><span class="markdown"><p>Use this method to set any property of the entity.</p>
</span><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.attr</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">Object </span><span class="sig-noun">map</span></span><span class="sig-seperator">[,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Boolean </span><span class="sig-noun">silent</span></span><span class="sig-seperator">[,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Boolean </span><span class="sig-noun">recursive</span></span><span class="sig-seperator">]])</span></code><dl class="parameter"><dt> map </dt><dd><span class="markdown"><p>Object where each key is the property to modify and the value as the property value</p>
</span></dd></dl><dl class="parameter"><dt> silent </dt><dd><span class="markdown"><p>If you would like to supress events</p>
</span></dd></dl><dl class="parameter"><dt> recursive </dt><dd><span class="markdown"><p>If you would like merge recursively</p>
</span></dd></dl></div><span class="markdown"><p>Use this method to set multiple properties of the entity.</p>
<p>Setter options:</p>
<ul>
<li><code>silent</code>: If you want to prevent it from firing events.</li>
<li><code>recursive</code>: If you pass in an object you could overwrite sibling keys, this recursively merges instead of just merging it. This is <code>false</code> by default, unless you are using dot notation <code>name.first</code>.</li>
</ul>
</span><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">Any </span><span class="sig-noun">.attr</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">property</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> property </dt><dd><span class="markdown"><p>Property of the entity to modify</p>
</span></dd></dl><dl class="parameter returns"><dt class="returns"> [Returns] </dt><dd><span class="markdown"><p>Value - the value of the property</p>
</span></dd></dl></div><span class="markdown"><p>Use this method to get any property of the entity. You can also retrieve the property using <code>this.property</code>.</p>
</span><div class="example"><h4>Example</h4><span class="markdown"><pre><code class="hljs "><span class="hljs-keyword">this</span>.attr({<span class="hljs-attr">key</span>: <span class="hljs-string">"value"</span>, <span class="hljs-attr">prop</span>: <span class="hljs-number">5</span>});
<span class="hljs-keyword">this</span>.attr(<span class="hljs-string">"key"</span>); <span class="hljs-comment">// returns "value"</span>
<span class="hljs-keyword">this</span>.attr(<span class="hljs-string">"prop"</span>); <span class="hljs-comment">// returns 5</span>
<span class="hljs-keyword">this</span>.key; <span class="hljs-comment">// "value"</span>
<span class="hljs-keyword">this</span>.prop; <span class="hljs-comment">// 5</span>

<span class="hljs-keyword">this</span>.attr(<span class="hljs-string">"key"</span>, <span class="hljs-string">"newvalue"</span>);
<span class="hljs-keyword">this</span>.attr(<span class="hljs-string">"key"</span>); <span class="hljs-comment">// returns "newvalue"</span>
<span class="hljs-keyword">this</span>.key; <span class="hljs-comment">// "newvalue"</span>

<span class="hljs-keyword">this</span>.attr(<span class="hljs-string">"parent.child"</span>, <span class="hljs-string">"newvalue"</span>);
<span class="hljs-keyword">this</span>.parent; <span class="hljs-comment">// {child: "newvalue"};</span>
<span class="hljs-keyword">this</span>.attr(<span class="hljs-string">'parent.child'</span>); <span class="hljs-comment">// "newvalue"</span></code></pre></span></div></div><div class="doclet" id="-bind"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.bind()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.bind</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">eventName</span></span><span class="sig-seperator">,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Function </span><span class="sig-noun">callback</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> eventName </dt><dd><span class="markdown"><p>Name of the event to bind to</p>
</span></dd></dl><dl class="parameter"><dt> callback </dt><dd><span class="markdown"><p>Method to execute when the event is triggered</p>
</span></dd></dl></div><span class="markdown"><p>Attach the current entity (or entities) to listen for an event.</p>
<p>Callback will be invoked when an event with the event name passed
is triggered. Depending on the event, some data may be passed
via an argument to the callback function.</p>
<p>The first argument is the event name (can be anything) whilst the
second argument is the callback. If the event has data, the
callback should have an argument.</p>
<p>Events are arbitrary and provide communication between components.
You can trigger or bind an event even if it doesn&#39;t exist yet.</p>
<p>Unlike DOM events, Crafty events are executed synchronously.</p>
</span><div class="example"><h4>Example</h4><span class="markdown"><pre><code class="hljs "><span class="hljs-keyword">this</span>.attr(<span class="hljs-string">"triggers"</span>, <span class="hljs-number">0</span>); <span class="hljs-comment">//set a trigger count</span>
<span class="hljs-keyword">this</span>.bind(<span class="hljs-string">"myevent"</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">this</span>.triggers++; <span class="hljs-comment">//whenever myevent is triggered, increment</span>
});
<span class="hljs-keyword">this</span>.bind(<span class="hljs-string">"EnterFrame"</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">this</span>.trigger(<span class="hljs-string">"myevent"</span>); <span class="hljs-comment">//trigger myevent on every frame</span>
});</code></pre></span></div><div><h4>See Also</h4><ul class="see-also-list"><li><a href="#-trigger">.trigger</a></li><li><a href="#-unbind">.unbind</a></li></ul></div></div><div class="doclet" id="-clone"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.clone()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">Entity </span><span class="sig-noun">.clone</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-noun">void</span></span><span class="sig-seperator">)</span></code><dl class="parameter returns"><dt class="returns"> [Returns] </dt><dd><span class="markdown"><p>Cloned entity of the current entity</p>
</span></dd></dl></div><span class="markdown"><p>Method will create another entity with the exact same
properties, components and methods as the current entity.</p>
</span></div><div class="doclet" id="-defineField"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.defineField()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.defineField</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">property</span></span><span class="sig-seperator">,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Function </span><span class="sig-noun">getCallback</span></span><span class="sig-seperator">,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Function </span><span class="sig-noun">setCallback</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> property </dt><dd><span class="markdown"><p>Property name to assign getter &amp; setter to</p>
</span></dd></dl><dl class="parameter"><dt> getCallback </dt><dd><span class="markdown"><p>Method to execute if the property is accessed</p>
</span></dd></dl><dl class="parameter"><dt> setCallback </dt><dd><span class="markdown"><p>Method to execute if the property is mutated</p>
</span></dd></dl></div><span class="markdown"><p>Assigns getters and setters to the property.
A getter will watch a property waiting for access and will then invoke the
given getCallback when attempting to retrieve.
A setter will watch a property waiting for mutation and will then invoke the
given setCallback when attempting to modify.</p>
</span><div class="example"><h4>Example</h4><span class="markdown"><pre><code class="hljs "><span class="hljs-keyword">var</span> ent = Crafty.e(<span class="hljs-string">"2D"</span>);
ent.defineField(<span class="hljs-string">"customData"</span>, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
   <span class="hljs-keyword">return</span> <span class="hljs-keyword">this</span>._customData;
}, <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">newValue</span>) </span>{
   <span class="hljs-keyword">this</span>._customData = newValue;
});

ent.customData = <span class="hljs-string">"2"</span> <span class="hljs-comment">// set customData to 2</span>
Crafty.log(ent.customData) <span class="hljs-comment">// prints 2</span></code></pre></span></div></div><div class="doclet" id="-destroy"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.destroy()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.destroy</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-noun">void</span></span><span class="sig-seperator">)</span></code></div><span class="markdown"><p>Will remove all event listeners and delete all properties as well as removing from the stage</p>
</span></div><div class="doclet" id="-each"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.each()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.each</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">Function </span><span class="sig-noun">method</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> method </dt><dd><span class="markdown"><p>Method to call on each iteration</p>
</span></dd></dl></div><span class="markdown"><p>Iterates over found entities, calling a function for every entity.</p>
<p>The function will be called for every entity and will pass the index
in the iteration as an argument. The context (value of <code>this</code>) of the
function will be the current entity in the iteration.</p>
</span><div class="example"><h4>Example</h4><span class="markdown"><p>Destroy every second 2D entity</p>
<pre><code class="hljs ">Crafty(<span class="hljs-string">"2D"</span>).each(<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">i</span>) </span>{
    <span class="hljs-keyword">if</span>(i % <span class="hljs-number">2</span> === <span class="hljs-number">0</span>) {
        <span class="hljs-keyword">this</span>.destroy();
    }
});</code></pre></span></div></div><div class="doclet" id="-get"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.get()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">Array </span><span class="sig-noun">.get</span></span><span class="sig-seperator">()</span></code><dl class="parameter returns"><dt class="returns"> [Returns] </dt><dd><span class="markdown"><p>An array of entities corresponding to the active selector</p>
</span></dd></dl></div><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">Entity </span><span class="sig-noun">.get</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">Number </span><span class="sig-noun">index</span></span><span class="sig-seperator">)</span></code><dl class="parameter returns"><dt class="returns"> [Returns] </dt><dd><span class="markdown"><p>an entity belonging to the current selection</p>
</span></dd></dl><dl class="parameter"><dt> index </dt><dd><span class="markdown"><p>The index of the entity to return.  If negative, counts back from the end of the array.</p>
</span></dd></dl></div><div class="example"><h4>Example</h4><span class="markdown"><p>Get an array containing every &quot;2D&quot; entity</p>
<pre><code class="hljs "><span class="hljs-keyword">var</span> arr = Crafty(<span class="hljs-string">"2D"</span>).get()</code></pre><p>Get the first entity matching the selector</p>
<pre><code class="hljs "><span class="hljs-comment">// equivalent to Crafty("2D").get()[0], but doesn't create a new array</span>
<span class="hljs-keyword">var</span> e = Crafty(<span class="hljs-string">"2D"</span>).get(<span class="hljs-number">0</span>)</code></pre><p>Get the last &quot;2D&quot; entity matching the selector</p>
<pre><code class="hljs "><span class="hljs-keyword">var</span> e = Crafty(<span class="hljs-string">"2D"</span>).get(<span class="hljs-number">-1</span>)</code></pre></span></div></div><div class="doclet" id="-getId"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.getId()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">Number </span><span class="sig-noun">.getId</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-noun">void</span></span><span class="sig-seperator">)</span></code><dl class="parameter returns"><dt class="returns"> [Returns] </dt><dd><span class="markdown"><p>the ID of this entity.</p>
</span></dd></dl></div><span class="markdown"><p>For better performance, simply use the this[0] property.</p>
</span><div class="example"><h4>Example</h4><span class="markdown"><p>Finding out the <code>ID</code> of an entity can be done by returning the property <code>0</code>.</p>
<pre><code class="hljs ">   <span class="hljs-keyword">var</span> ent = Crafty.e(<span class="hljs-string">"2D"</span>);
   ent[<span class="hljs-number">0</span>]; <span class="hljs-comment">//ID</span>
   ent.getId(); <span class="hljs-comment">//also ID</span></code></pre></span></div></div><div class="doclet" id="-getName"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.getName()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.getName</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">name</span></span><span class="sig-seperator">)</span></code><dl class="parameter returns"><dt class="returns"> [Returns] </dt><dd><span class="markdown"><p>A human readable name for debugging purposes.</p>
</span></dd></dl></div><span class="markdown"><p>Get the human readable name for debugging purposes.</p>
</span><div class="example"><h4>Example</h4><span class="markdown"><pre><code class="hljs "><span class="hljs-keyword">var</span> ent = Crafty.e().setName(<span class="hljs-string">"Player"</span>);
<span class="hljs-keyword">var</span> name = ent.getName();</code></pre></span></div><div><h4>See Also</h4><ul class="see-also-list"><li><a href="Crafty Core.html#-setName">Crafty Core.setName</a></li></ul></div></div><div class="doclet" id="-has"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.has()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">Boolean </span><span class="sig-noun">.has</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">component</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> component </dt><dd><span class="markdown"><p>The name of the component to check</p>
</span></dd></dl><dl class="parameter returns"><dt class="returns"> [Returns] </dt><dd><span class="markdown"><p><code>true</code> or <code>false</code> depending on if the entity has the given component.</p>
</span></dd></dl></div><span class="markdown"><p>For better performance, simply use the <code>.__c</code> object
which will be <code>true</code> if the entity has the component or
will not exist (or be <code>false</code>).</p>
</span></div><div class="doclet" id="-one"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.one()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">Number </span><span class="sig-noun">one</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">eventName</span></span><span class="sig-seperator">,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Function </span><span class="sig-noun">callback</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> eventName </dt><dd><span class="markdown"><p>Name of the event to bind to</p>
</span></dd></dl><dl class="parameter"><dt> callback </dt><dd><span class="markdown"><p>Method to execute upon event triggered</p>
</span></dd></dl><dl class="parameter returns"><dt class="returns"> [Returns] </dt><dd><span class="markdown"><p>ID of the current callback used to unbind</p>
</span></dd></dl></div><span class="markdown"><p>Works like Crafty.bind, but will be unbound once the event triggers.</p>
</span><div><h4>See Also</h4><ul class="see-also-list"><li><a href="#-bind">.bind</a></li></ul></div></div><div class="doclet" id="-removeComponent"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.removeComponent()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.removeComponent</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">Component</span></span><span class="sig-seperator">[,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-noun">soft</span></span><span class="sig-seperator">])</span></code><dl class="parameter"><dt> component </dt><dd><span class="markdown"><p>Component to remove</p>
</span></dd></dl><dl class="parameter"><dt> soft </dt><dd><span class="markdown"><p>Whether to soft remove it (defaults to <code>true</code>)</p>
</span></dd></dl></div><span class="markdown"><p>Removes a component from an entity. A soft remove (the default) will only
refrain <code>.has()</code> from returning true. Hard will remove all
associated properties and methods.</p>
</span><div class="example"><h4>Example</h4><span class="markdown"><pre><code class="hljs "><span class="hljs-keyword">var</span> e = Crafty.e(<span class="hljs-string">"2D,DOM,Test"</span>);
e.removeComponent(<span class="hljs-string">"Test"</span>);        <span class="hljs-comment">//Soft remove Test component</span>
e.removeComponent(<span class="hljs-string">"Test"</span>, <span class="hljs-literal">false</span>); <span class="hljs-comment">//Hard remove Test component</span></code></pre></span></div></div><div class="doclet" id="-requires"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.requires()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.requires</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">componentList</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> componentList </dt><dd><span class="markdown"><p>List of components that must be added</p>
</span></dd></dl></div><span class="markdown"><p>Makes sure the entity has the components listed. If the entity does not
have the component, it will add it.</p>
<p>(In the current version of Crafty, this function behaves exactly the same
as <code>addComponent</code>. By convention, developers have used <code>requires</code> for
component dependencies -- i.e. to indicate specifically that one component
will only work properly if another component is present -- and used
<code>addComponent</code> in all other situations.)</p>
</span><div><h4>See Also</h4><ul class="see-also-list"><li><a href="#-addComponent">.addComponent</a></li></ul></div></div><div class="doclet" id="-setName"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.setName()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.setName</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">name</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> name </dt><dd><span class="markdown"><p>A human readable name for debugging purposes.</p>
</span></dd></dl></div><span class="markdown"><p>Set a human readable name for debugging purposes.</p>
</span><div class="example"><h4>Example</h4><span class="markdown"><pre><code class="hljs "><span class="hljs-keyword">var</span> ent = Crafty.e().setName(<span class="hljs-string">"Player"</span>);</code></pre></span></div><div><h4>See Also</h4><ul class="see-also-list"><li><a href="Crafty Core.html#-getName">Crafty Core.getName</a></li></ul></div></div><div class="doclet" id="-setter"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.setter()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.setter</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">property</span></span><span class="sig-seperator">,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Function </span><span class="sig-noun">callback</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> property </dt><dd><span class="markdown"><p>Property to watch for modification</p>
</span></dd></dl><dl class="parameter"><dt> callback </dt><dd><span class="markdown"><p>Method to execute if the property is modified</p>
</span></dd></dl></div><span class="markdown"><p>Will watch a property waiting for modification and will then invoke the
given callback when attempting to modify.</p>
<p>This feature is deprecated; use .defineField() instead.</p>
</span><div><h4>See Also</h4><ul class="see-also-list"><li><a href="#-defineField">.defineField</a></li></ul></div></div><div class="doclet" id="-timeout"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.timeout()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.timeout</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">Function </span><span class="sig-noun">callback</span></span><span class="sig-seperator">,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Number </span><span class="sig-noun">delay</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> callback </dt><dd><span class="markdown"><p>Method to execute after given amount of milliseconds</p>
</span></dd></dl><dl class="parameter"><dt> delay </dt><dd><span class="markdown"><p>Amount of milliseconds to execute the method</p>
</span></dd></dl></div><span class="markdown"><p>The delay method will execute a function after a given amount of time in milliseconds.</p>
<p>Essentially a wrapper for <code>setTimeout</code>.</p>
</span><div class="example"><h4>Example</h4><span class="markdown"><p>Destroy itself after 100 milliseconds</p>
<pre><code class="hljs "><span class="hljs-keyword">this</span>.timeout(<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>) </span>{
<span class="hljs-keyword">this</span>.destroy();
}, <span class="hljs-number">100</span>);</code></pre></span></div></div><div class="doclet" id="-toArray"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.toArray()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.toArray</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-noun">void</span></span><span class="sig-seperator">)</span></code></div><span class="markdown"><p>This method will simply return the found entities as an array of ids.  To get an array of the actual entities, use <code>get()</code>.</p>
</span><div><h4>See Also</h4><ul class="see-also-list"><li><a href="#-get">.get</a></li></ul></div></div><div class="doclet" id="-toggleComponent"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.toggleComponent()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.toggleComponent</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">ComponentList</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> ComponentList </dt><dd><span class="markdown"><p>A string of components to add or remove separated by a comma <code>,</code></p>
</span></dd></dl></div><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.toggleComponent</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">Component1</span></span><span class="sig-seperator">[,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-noun">..</span></span><span class="sig-seperator">,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">String </span><span class="sig-noun">componentN</span></span><span class="sig-seperator">])</span></code><dl class="parameter"><dt> Component# </dt><dd><span class="markdown"><p>Component ID to add or remove.</p>
</span></dd></dl></div><span class="markdown"><p>Add or Remove Components from an entity.</p>
</span><div class="example"><h4>Example</h4><span class="markdown"><pre><code class="hljs "><span class="hljs-keyword">var</span> e = Crafty.e(<span class="hljs-string">"2D,DOM,Test"</span>);
e.toggleComponent(<span class="hljs-string">"Test,Test2"</span>); <span class="hljs-comment">//Remove Test, add Test2</span>
e.toggleComponent(<span class="hljs-string">"Test,Test2"</span>); <span class="hljs-comment">//Add Test, remove Test2</span></code></pre><pre><code class="hljs "><span class="hljs-keyword">var</span> e = Crafty.e(<span class="hljs-string">"2D,DOM,Test"</span>);
e.toggleComponent(<span class="hljs-string">"Test"</span>,<span class="hljs-string">"Test2"</span>); <span class="hljs-comment">//Remove Test, add Test2</span>
e.toggleComponent(<span class="hljs-string">"Test"</span>,<span class="hljs-string">"Test2"</span>); <span class="hljs-comment">//Add Test, remove Test2</span>
e.toggleComponent(<span class="hljs-string">"Test"</span>);         <span class="hljs-comment">//Remove Test</span></code></pre></span></div></div><div class="doclet" id="-trigger"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.trigger()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.trigger</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">eventName</span></span><span class="sig-seperator">[,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Object </span><span class="sig-noun">data</span></span><span class="sig-seperator">])</span></code><dl class="parameter"><dt> eventName </dt><dd><span class="markdown"><p>Event to trigger</p>
</span></dd></dl><dl class="parameter"><dt> data </dt><dd><span class="markdown"><p>Arbitrary data that will be passed into every callback as an argument</p>
</span></dd></dl></div><span class="markdown"><p>Trigger an event with arbitrary data. Will invoke all callbacks with
the context (value of <code>this</code>) of the current entity object.</p>
<p><em>Note: This will only execute callbacks within the current entity, no other entity.</em></p>
<p>The first argument is the event name to trigger and the optional
second argument is the arbitrary event data. This can be absolutely anything.</p>
<p>Unlike DOM events, Crafty events are executed synchronously.</p>
</span></div><div class="doclet" id="-unbind"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.unbind()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">this </span><span class="sig-noun">.unbind</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">eventName</span></span><span class="sig-seperator">[,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Function </span><span class="sig-noun">callback</span></span><span class="sig-seperator">])</span></code><dl class="parameter"><dt> eventName </dt><dd><span class="markdown"><p>Name of the event to unbind</p>
</span></dd></dl><dl class="parameter"><dt> callback </dt><dd><span class="markdown"><p>Function to unbind</p>
</span></dd></dl></div><span class="markdown"><p>Removes binding with an event from current entity.</p>
<p>Passing an event name will remove all events bound to
that event. Passing a reference to the callback will
unbind only that callback.</p>
</span><div><h4>See Also</h4><ul class="see-also-list"><li><a href="#-bind">.bind</a></li><li><a href="#-trigger">.trigger</a></li></ul></div></div><div class="doclet" id="-uniqueBind"><a href="#doc-nav" class="doc-top">Back to top</a><h2 class="doclet-header">.uniqueBind()</h2><div class="crafty-method"><code class="signature"><span class="sig-phrase"><span class="sig-qualifier">public </span><span class="sig-qualifier">Number </span><span class="sig-noun">.uniqueBind</span></span><span class="sig-seperator">(</span><span class="sig-phrase"><span class="sig-qualifier">String </span><span class="sig-noun">eventName</span></span><span class="sig-seperator">,</span><span class="sig-phrase"><span class="sig-qualifier"> </span><span class="sig-qualifier">Function </span><span class="sig-noun">callback</span></span><span class="sig-seperator">)</span></code><dl class="parameter"><dt> eventName </dt><dd><span class="markdown"><p>Name of the event to bind to</p>
</span></dd></dl><dl class="parameter"><dt> callback </dt><dd><span class="markdown"><p>Method to execute upon event triggered</p>
</span></dd></dl><dl class="parameter returns"><dt class="returns"> [Returns] </dt><dd><span class="markdown"><p>ID of the current callback used to unbind</p>
</span></dd></dl></div><span class="markdown"><p>Works like Crafty.bind, but prevents a callback from being bound multiple times.</p>
</span><div><h4>See Also</h4><ul class="see-also-list"><li><a href="#-bind">.bind</a></li></ul></div></div></div></div></div></div>
			
		</div>
	</div>
	<div class="clearer"></div>
	<div id="footer">
		<div id="contact">
			<a href="https://groups.google.com/forum/#!forum/craftyjs">
				<img src="../images/google.png" />
				google groups</a>
			<a href="mailto:starwed@gmail.com">
				<img src="../images/email.png" />
				starwed@gmail.com</a>
			<a href="https://github.com/craftyjs/Crafty">
				<img src="../images/github.png" />
				github</a>
		</div>
		<ul>
			<li><a href="../">首页</a></li>
				<li><a href="../getting-started/">快速开始</a></li>
				<li><a href="../documentation/">文档</a></li>
				<li><a href="../api/">API</a></li>
				<li><a href="../components/">组件</a></li>
				<li class="emph"><a href="../#install">下载</a></li>
		</ul>
		<p>
			&copy; Crafty 2010-2015. Crafty is distributed under the <a href="http://en.wikipedia.org/wiki/MIT_License">MIT License</a>.
		</p>
	</div>
</div>
</body>
</html>
